#这里究竟是要先生成数据集还是直接做可视化？要不先等等？
#不等了，先写着吧
import Net
class visualization:
    def __init__(self):
        #
        # self.modelarray = []
        # self.models = []
        # with open(modelpath,'rb') as fp:
        #     str1 = fp.readline().__str__().__str__()
        #     num = int(str1[2:-5])
        #     print("可视化面数")
        #     print(num)
        #     for i in range(num):
        #         tempstr = fp.readline().__str__().__str__()
        #         numstr = tempstr[2:-5]
        #         tempmodel = Net.net
        #         tempmodel.setpara(0,0,int(numstr[0]))
        #         tempmodel.setpara(0,1,int(numstr[2]))
        #         tempmodel.setpara(0,2,int(numstr[4]))
        #         tempmodel.setpara(0,3,int(numstr[6]))
        #
        # print("载入模型结束")
        print("可视化工具构造成功")

    def normal(self, points):
        with open('data/visualSurfacePoint.txt', 'a') as fp:
            for i in range(points.__len__()):
                fp.write(str(points[i][0]))
                fp.write(" ")
                fp.write(str(points[i][1]))
                fp.write(" ")
                fp.write(str(points[i][2]))
                fp.write(" ")
                fp.write(str(0))
                fp.write(" ")
                fp.write(str(255))
                fp.write(" ")
                fp.write(str(0))
                fp.write("\n")

    def losspoint(self,points,path):
        with open(path, 'w') as fp:
            print(points.__len__())
            for i in range(points.__len__()):
                fp.write(str(points[i][0][0] * 128))
                fp.write(" ")
                fp.write(str(points[i][0][1] * 128))
                fp.write(" ")
                fp.write(str(points[i][0][2] * 128))
                fp.write(" ")
                fp.write(str(255))
                fp.write(" ")
                fp.write(str(0))
                fp.write(" ")
                fp.write(str(0))
                fp.write("\n")